FROM java:8u111-jdk-alpine
#维护者
MAINTAINER kzj@thunisoft.com

RUN echo "http://mirrors.aliyun.com/alpine/v3.4/main/" > /etc/apk/repositories && \
    apk --no-cache add tzdata  && \
    ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone

# 拷贝程序
ADD CollegeEmploymentNetwork.jar app.jar

#拷贝配置文件
COPY application.yml /opt/thunisoft/configs/CollegeEmploymentNetwork/application.yml
COPY application-dev.yml /opt/thunisoft/configs/CollegeEmploymentNetwork/application-dev.yml
COPY application-prod.yml /opt/thunisoft/configs/CollegeEmploymentNetwork/application-prod.yml

# 暴露端口
EXPOSE 8080

# 日志及配置文件存储卷
VOLUME ["/logs","/opt/thunisoft/configs/CollegeEmploymentNetwork"]

# 设置环境变量
ENV CONFIGFILE="/opt/thunisoft/configs/CollegeEmploymentNetwork/application.yml,/opt/thunisoft/configs/CollegeEmploymentNetwork/application-dev.yml,/opt/thunisoft/configs/CollegeEmploymentNetwork/application-prod.yml"
ENV PROFILES="dev" LOGLEVEL="INFO" PARAMS="" 

#镜像入口
ENTRYPOINT ["sh", "-c", "java $PARAMS  -Djava.security.egd=file:/dev/./urandom -jar app.jar --spring.config.location=$CONFIGFILE --spring.profiles.active=$PROFILES --logback.level.root=$LOGLEVEL"]